libxl: Fix bug in libxl_cdrom_insert, make more robust against bad xenstore data
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Tue, 27 Nov 2012 14:13:41 +0000 (14:13 +0000)
committerGeorge Dunlap <george.dunlap@eu.citrix.com>
Tue, 27 Nov 2012 14:13:41 +0000 (14:13 +0000)
commitc3556e2a1aee3c9b7dda5d57e85e8867fff1b9da
tree99fad174c9461ad23305eb6d5b65ba6b8aad70f5
parent833ea62ccb6885679c70198aebc6574364a773f3
libxl: Fix bug in libxl_cdrom_insert, make more robust against bad xenstore data

libxl_cdrom_insert was failing to initialize the backend type,
resulting in the wrong default backend.  The result was not only that
the CD was not inserted properly, but also that some improper xenstore
entries were created, causing further block commands to fail.

This patch fixes the bug by setting the disk backend type based on the
type of the existing device.

It also makes the system more robust by checking to see that it has
got a valid path before proceeding to write a partial xenstore entry.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl.c